﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    internal class Class2
    {

        public static bool H;
        public static bool h;
        public static bool I;
        public static int i;
        public static int J;
        public const int j = 128;
        public const int K = 262144;

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "InitComm")]
        private static extern int A([In] int obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "InitCommExt")]
        private static extern int A();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "CloseComm")]
        private static extern int a();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "Authenticate")]
        private static extern int B();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "Read_Content")]
        public static extern int a([In] int obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "ReadContent")]
        public static extern int B([In] int obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetSAMID")]
        private static extern int A([In] StringBuilder obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetSAMIDEx")]
        private static extern int a([In] StringBuilder obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetBmpPhoto")]
        private static extern int A([In] string obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetBmpPhotoToMem")]
        private static extern int A([In] byte[] obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetBmpPhotoExt")]
        private static extern int b();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "Reset_SAM")]
        private static extern int C();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetSAMStatus")]
        private static extern int c();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetCardInfo")]
        private static extern int A([In] int obj0, [In] StringBuilder obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "ExportCardImageV")]
        private static extern int D();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "ExportCardImageH")]
        private static extern int d();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "SetTempDir")]
        private static extern int a([In] string obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetTempDir")]
        private static extern int A([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetPhotoJPGPathName")]
        private static extern void a([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "SetPhotoJPGPathName")]
        private static extern int B([In] string obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "SetCardJPGPathNameV")]
        private static extern int b([In] string obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetCardJPGPathNameV")]
        private static extern int B([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "SetCardJPGPathNameH")]
        private static extern int C([In] string obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "GetCardJPGPathNameH")]
        private static extern int b([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getName")]
        private static extern int C([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getSex")]
        private static extern int c([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getNation")]
        private static extern int D([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getBirthdate")]
        private static extern int d([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getAddress")]
        private static extern int E([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getIDNum")]
        private static extern int e([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getIssue")]
        private static extern int F([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getEffectedDate")]
        private static extern int f([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getExpiredDate")]
        private static extern int G([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getBMPPhotoBase64")]
        private static extern int g([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getJPGPhotoBase64")]
        private static extern int _H([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getJPGCardBase64V")]
        private static extern int _h([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getJPGCardBase64H")]
        private static extern int _I([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "HIDVoice")]
        private static extern int b([In] int obj0);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_SetDevNum")]
        private static extern int A([In] int obj0, [In] StringBuilder obj1, [In] int obj2);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_GetDevNum")]
        private static extern int a([In] int obj0, [In] StringBuilder obj1, [In] int obj2);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_GetDevVersion")]
        private static extern int B([In] int obj0, [In] StringBuilder obj1, [In] int obj2);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_WriteData")]
        private static extern int A(
          [In] int obj0,
          [In] int obj1,
          [In] int obj2,
          [In] int obj3,
          [In] StringBuilder obj4,
          [In] StringBuilder obj5,
          [In] int obj6,
          [In] ref uint obj7);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_ReadData")]
        private static extern int a(
          [In] int obj0,
          [In] int obj1,
          [In] int obj2,
          [In] int obj3,
          [In] StringBuilder obj4,
          [In] StringBuilder obj5,
          [In] int obj6,
          [In] ref uint obj7);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_GetICSnr")]
        private static extern int A([In] int obj0, [In] ref uint obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_GetIDSnr")]
        private static extern int b([In] int obj0, [In] StringBuilder obj1, [In] int obj2);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getEnName")]
        private static extern int _i([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getCnName")]
        private static extern int _J([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getPassNum")]
        private static extern int _j([In] StringBuilder obj0, [In] int obj1);

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "getVisaTimes")]
        private static extern int E();

        [DllImport("D:\\Program Files (x86)\\IDCDServer\\身份证读卡仪服务V2.0\\\\termb.dll", EntryPoint = "IC_ChangeSectorKey")]
        private static extern int A(
          [In] int obj0,
          [In] int obj1,
          [In] int obj2,
          [In] StringBuilder obj3,
          [In] StringBuilder obj4);




        public static string e()
        {
            try
            {
                int num = ConsoleApp1.Class2.A();
                if (num <= 0)
                    return Unk.b();
                ConsoleApp1.Class2.i = num;
                ConsoleApp1.Class2.H = true;
                StringBuilder stringBuilder = new StringBuilder(128);
                ConsoleApp1.Class2.A(stringBuilder);
                return stringBuilder.ToString();
            }
            catch (Exception ex)
            {
                ConsoleApp1.Class2.A(Unk.ac() + ex.ToString());
                return Unk.b();
            }
        }


        public static string F()
        {
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            Unk.b();
            try
            {
                if (ConsoleApp1.Class2.A() <= 0)
                    return Unk.aO();
                if (ConsoleApp1.Class2.B() == 1)
                    ;
                int num1 = ConsoleApp1.Class2.a(1);
                int num;
                switch (num1)
                {
                    case 1:
                    case 2:
                        num = 0;
                        break;
                    default:
                        num = num1 != 3 ? 1 : 0;
                        break;
                }
                if (num != 0)
                    return Unk.aD();
                StringBuilder stringBuilder = new StringBuilder(128);
                Unk.b();
                ConsoleApp1.Class2.A(stringBuilder);
                string str1 = stringBuilder.ToString();
                string str2 = Code.b(DateTime.Now.ToString(Unk.ad()));
                string str3 = IncAB.a(IncAB.b()) + str2;
                ConsoleApp1.Class2.C(stringBuilder, 128);
                string str4 = stringBuilder.ToString();
                ConsoleApp1.Class2.D(stringBuilder, 128);
                string str5 = stringBuilder.ToString();
                ConsoleApp1.Class2.c(stringBuilder, 128);
                string str6 = stringBuilder.ToString();
                ConsoleApp1.Class2.d(stringBuilder, 128);
                string str7 = stringBuilder.ToString();
                ConsoleApp1.Class2.E(stringBuilder, 128);
                string str8 = stringBuilder.ToString();
                ConsoleApp1.Class2.e(stringBuilder, 128);
                string str9 = stringBuilder.ToString();
                ConsoleApp1.Class2.F(stringBuilder, 128);
                string str10 = stringBuilder.ToString();
                ConsoleApp1.Class2.f(stringBuilder, 128);
                string str11 = stringBuilder.ToString();
                ConsoleApp1.Class2.G(stringBuilder, 128);
                string str12 = stringBuilder.ToString();
                ConsoleApp1.Class2.b();
                int capacity = 262144;
                ConsoleApp1.Class2.g(new StringBuilder(capacity), capacity);
                string str13 = AppDomain.CurrentDomain.BaseDirectory + Unk.aE();
                RelIncAB.A(Unk.ae() + str13);
                string str14 = IncAB.A(str13);
                ConsoleApp1.Class2.b(1);
                string str15 = Unk.aF();
                string str16 = Unk.af() + str14.ToString() + Unk.aG() + Unk.ag() + str4 + Unk.aG() + Unk.aH() + str6 + Unk.aG() + Unk.ah() + str5 + Unk.aG() + Unk.aI() + str7 + Unk.aG() + Unk.ai() + str8 + Unk.aG() + Unk.aJ() + str9 + Unk.aG() + Unk.aj() + str10 + Unk.aG() + Unk.aK() + str11 + Unk.aG() + Unk.ak() + str12 + Unk.aG() + Unk.aL() + str1 + Unk.aG() + Unk.al() + str3 + Unk.aM();
                return (str15 + Unk.am() + Code.b(str16.Replace(Unk.aN(), Unk.b())) + Unk.am() + Unk.an()).Replace(Unk.aN(), Unk.b());
                //return str15;
            }
            catch (Exception ex)
            {
                //A.b.A(Unk.ao() + ex.ToString());
                return Unk.aP();
            }
        }

    }
}
